/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package customer_cmds;

import appClientHandler.AUPBeanRemote;
import appClientHandler.AUPCustomerRemote;
import appClientHandler.LoginResult;
import appClientHandler.Output;
import commands.CartCommand;
import commands.CommandAbstractAction;
import customer_jdom.AccountJDOM;
import entities.Cart;
import entities.Commande;
import general.OptionBase;
import general.OptionName;

import java.util.List;

/**
 *
 * eCOM - Adopte un Presta - Mars-Avril 2013
 * @author Kheira, Jef, William, Tuan-Long
 */
public class OutputCommand extends CommandAbstractAction {
    
        private final AUPBeanRemote aupCustomerRemote;

        public OutputCommand(AUPBeanRemote aupCustomerRemote) {
            super();
            this.aupCustomerRemote = aupCustomerRemote;
            addOption(new OptionBase("XML", true));
            addOption(new OptionBase("HTML", true));
            addOption(new OptionBase("JSON", true));
            addOption(new OptionBase("TEXT", true));
            addOption(new OptionBase("WML", true));
        }


        @Override
	public String getName() {
		return "output";
	}

	@Override
	public String getUsage() {
		return "output --<format>";
	}

	@Override
	public String getShortDescription() {
		return "Format de l'output [XML,TEXT,HTML]";
	}

        @Override
	public void defaultAction(){
            String output = this.aupCustomerRemote.getOutput();
            if(output != null){
                this.getOut().println("Current Output : " + output);
            }else{
                this.getOut().println("Unknown Current Output");
            }
            
        }

        public void XMLAction(){
            this.aupCustomerRemote.setOutput(Output.XML);
        }

        public void HTMLAction(){
            this.aupCustomerRemote.setOutput(Output.HTML);
        }

        public void TEXTAction(){
            this.aupCustomerRemote.setOutput(Output.TEXT);
        }

        public void WMLAction(){
            this.aupCustomerRemote.setOutput(Output.WML);
        }

        public void JSONAction(){
            this.aupCustomerRemote.setOutput(Output.JSON);
        }
    
}
